#ifndef STORAGE_H
#define STORAGE_H

#define INTERGET 32
#define TYPED_SETS 4
#define TYPE_MASK 0xF0000000
#define POINTER_MASK 0x0FFFFFFF
#define TYPE(x) (((x) & TYPE_MASK) >> (INTERGET-TYPED_SETS))
#define SET_TYPE(x, t) (x) = ((x) & POINTER_MASK | ((t) << (INTERGET-TYPED_SETS)))
#define POINTER(x) ((x) & POINTER_MASK )


typedef enum LIST_TYPE
{
    EList,
    ESymbol,
    EInteger,
    EString
} LISY_T;

#define MAX_STORAGE (TYPE_MASKE - 1)

/* 512k space */
#define VECTOR_SIZE (1024*512)

typedef int Indx;
typedef struct LIST_tag
{
    Indx Car;
    Indx Cdr;
} List;     

int list_prepare();
void list_close();

Indx list_car(Indx l);
Indx list_cdr(Indx l);
void list_set_car(Indx l, Indx car);
void list_set_cdr(Indx l, Indx cdr);
Indx list_cons(Indx car, Indx cdr);

int list_eq( Indx l, Indx r );

Indx obarray_append( char* src, size_t len );
List* obarray_get( Indx p );
#endif
